
Version:=3.3
ModuleName:=ntop

Objcet:=$(ModuleName).tgz
ObjectDir:=$(ModuleName)-$(Version)
ObjcetSource:=$(ModuleName)-$(Version).tar.gz

DependFiles:=

InstallDirTmp:=usr/local
InstallDir:=/$(InstallDirTmp)
InstallLib:=$(InstallDirTmp)/lib

Config:=./configure --disable-ipv6 --enable-sslv3 --enable-snmp --prefix=$(InstallDir)

Patch:= patch -p0 < ntop-3.3.patch

Data:=GeoIP.tar.gz lua-5.1.4.tar.gz oui.txt.gz specialMAC.txt.gz

.PHONY: all clean dist_clean

all:$(Objcet) 

$(Objcet):$(ObjcetSource) $(Data)
	tar -xzf $(ObjcetSource)
	#if [ -d etc ]; then rm -rf etc/*; else mkdir -p etc ;fi
	#cp -rf ntop.conf etc
	$(Patch)
	cp -rf $(Data) $(ObjectDir)
	cd $(ObjectDir) && ./autogen.sh && $(Config)
	$(MAKE) -C $(ObjectDir) 
	$(MAKE) -C $(ObjectDir) install DESTDIR=`pwd`/
	rm -rf usr/local/share/man
	if [ ! -d $(InstallLib) ]; then mkdir -p $(InstallLib); fi
	cp -afr /usr/lib/librrd_th.so.* /usr/lib/libfreetype.so.* \
		/usr/lib/libart_lgpl_2.so.* /usr/lib/libgdbm.so.* \
		$(InstallLib)
	cp -rf ntop_logo.gif usr/local/share/ntop/html
	$(g_STRIP)
	find usr -name *.a -exec rm -rf {} \;
	tar -czf $(Objcet) usr #etc

patch:
	mv $(ObjectDir) $(ObjectDir).new
	tar xzvf $(ObjcetSource)
	diff -Nur $(ObjectDir) $(ObjectDir).new > ntop-3.3.patch

clean:
	rm -rf usr $(Objcet) etc 

dist_clean:clean
	rm -rf $(ObjectDir) $(ObjcetSource) *.tar.gz *.new *.gz
	
include ../Makefile.Res
